<?php

namespace App\Console\Commands;

use App\Models\User;
use App\Services\ProxyService;
use Illuminate\Console\Command;

class CreateCustomer extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'command:createCustomer';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '创建客户帐号';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle(ProxyService $proxyService)
    {
        $data = User::where('id', '>', 100000)->where('customer_id', 0)->where('status', 1)->get();
        foreach ($data as $item) {
            $proxyService->addUser($item->id);
        }
        return true;
    }
}
